package com.hb.trans.mvp.ui.fragment


import com.alibaba.android.arouter.launcher.ARouter
import com.basiclib.base.BaseFragment
import com.hb.trans.R
import com.hb.trans.bean.TitleItem
import com.hb.trans.global.ACTIVITY_MAP
import com.hb.trans.mvp.contract.CarManagerContract
import com.hb.trans.mvp.presenter.CarManagerPresenter
import com.hb.trans.mvp.ui.adapter.TeacherItemAdapter
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.fragment_area_item.*
import javax.inject.Inject


class TeacherItemFragment : BaseFragment<CarManagerPresenter>(), CarManagerContract.View {
    private val titles1: List<String> by lazy { resources.getStringArray(R.array.company_detail_title_1).toList() }
    private val titleList1 = ArrayList<TitleItem>()

    override fun setViewId(): Int {
        return R.layout.fragment_area_item
    }

    @Inject
    lateinit var mAdapter: TeacherItemAdapter
    @Inject
    lateinit var mPresenter: CarManagerPresenter




    override fun doOnInvisible() {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun doOnVisible() {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }





    override fun onFragmentInject() {
        AndroidSupportInjection.inject(this)
    }

    override fun attachView() {
//        mPresenter.attachView(this)
    }

    override fun initView() {

    }

    override fun initData() {
//        var bundle = arguments
//        if (bundle == null) {
//            return
//        }
//        var inscode = bundle.getString("inscode")
//        mPresenter.getSchoolCoach(inscode)

        for (index in 0..titles1.size-1){
            var title = TitleItem(titles1[index],"str")
            titleList1.add(title)
        }


        mAdapter.setNewData(titleList1)
        areaItemList.apply {
            adapter = mAdapter
        }
    }

    override fun setListener() {
        mAdapter.setOnItemClickListener { adapter, _, position ->
            ARouter.getInstance().build(ACTIVITY_MAP).navigation()
        }

    }


//    private fun showNoDataView() {
//        rlNoData.visibility = View.VISIBLE
//        companyItemList.visibility = View.GONE
//    }
//
//    private fun showDataView() {
//        rlNoData.visibility = View.GONE
//        companyItemList.visibility = View.VISIBLE
//    }
}
